﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using Metro.Core;

namespace DayofWeek
{
    public class Widget : IWidget
    {
        private WidgetControl _widgetControl;
        public static Settings Sett;
        public static Widget Instance;
        //public static LocaleManager LocaleManager;

        public Widget()
        {
            Instance = this;
        }

        public string GetWidgetName()
        {
            return "Day of Week";
        }

        public UserControl Load()
        {
            Sett = Settings.Read(E.ConfigDirectory + "\\DayofWeek.conf");

           /*LocaleManager = new LocaleManager(E.Path + "\\DayofWeek\\Localization");
            LocaleManager.LoadLocale(E.Locale);*/

            _widgetControl = new WidgetControl();
            Grid.SetColumn(_widgetControl, Sett.Col);
            Grid.SetRow(_widgetControl, Sett.Row);
            return _widgetControl;
        }

        public UserControl GetWidgetControl()
        {
            return _widgetControl;
        }

        public void Unload()
        {
            Sett.Write(E.ConfigDirectory + "\\DayofWeek.conf");
        }

        public string GetIcon()
        {
            return null;
        }

        public Point GetPosition()
        {
            return new Point(Sett.Col, Sett.Row);
        }

        public void SetPosition(int x, int y)
        {
            Sett.Col = x;
            Sett.Row = y;
        }

        public void SetBackground(Brush brush)
        {
            SetBgBrush(brush);
        }

        public event AddContextMenuItemHandler AddContextMenuItem;
        public event SetBgBrushHandler SetBgBrush;
    }
}
